<?php if(isset($id_categoria)){?>
<h2><?php echo __('Trabalhos ').$categorias[$id_categoria];?></h2>
<?php }else{?>
<h2><?php echo __('Trabalhos ');?></h2>
<?php }?>
<div class="btn-toolbar">
	<div class="btn-group">
		<?php if(isset($id_categoria)){?>
			<?php echo $this->Html->link(__('Todos'), array('action'=>'index'), array('class'=>'btn'));?>
		<?php }else{?>
			<?php echo $this->Html->link(__('Todos'), 'javascript:void(0);', array('class'=>'btn btn-inverse disabled'));?>
		<?php }?>
		<?php foreach($categorias as $key=>$item){?>
			<?php if($key == $id_categoria){?>
				<?php echo $this->Html->link($item, 'javascript:void(0);', array('class'=>'btn btn-inverse disabled'));?>
			<?php }else{?>
			<?php echo $this->Html->link($item, array('action'=>'index', $key), array('class'=>'btn'));?>
			<?php }?>
		<?php }?>
	</div>
</div>
<table cellpadding="0" cellspacing="0" class="table table-striped table-bordered table-hover">
<thead>
<tr>
	<th><?php echo $this->Paginator->sort('sessao_id'); ?></th>
	<th><?php echo $this->Paginator->sort('usuario_id'); ?></th>
	<th><?php echo $this->Paginator->sort('revisor_id'); ?></th>
	<th><?php echo $this->Paginator->sort('titulo'); ?></th>
	<th><?php echo $this->Paginator->sort('autores'); ?></th>
	<th><?php echo $this->Paginator->sort('apresentador'); ?></th>
	<th width="10px" class="actions"><?php echo __('Opções'); ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($trabalhos as $trabalho):  ?>
<tr>
	<td><?php echo $trabalho['Sessao']['nome']; ?></td>
	<td><?php echo $this->Html->link($trabalho['Usuario']['nome'], array('controller'=>'usuarios', 'action'=>'view', $trabalho['Usuario']['id'])); ?>&nbsp;</td>
	<?php if(!empty($trabalho['Revisor']['id'])){?>
	<td><?php echo $this->Html->link($trabalho['Revisor']['nome'], array('controller'=>'usuarios', 'action'=>'view', $trabalho['Usuario']['id'])); ?>&nbsp;</td>
	<?php }else{?>
	<td>-</td>
	<?php }?>
	<td><?php echo h($trabalho['Trabalho']['titulo']); ?>&nbsp;</td>
	<td><?php echo h($trabalho['Trabalho']['autores']); ?>&nbsp;</td>
	<td><?php echo h($trabalho['Trabalho']['apresentador']); ?>&nbsp;</td>
	<td>
		<div class="btn-toolbar">
  			<div class="btn-group">
				<?php echo $this->Html->link('<i class="icon-download"></i>', array('action' => 'download', $trabalho['Trabalho']['id']), array('title'=>__('Download'), 'escape'=>false, 'class'=>'btn')); ?>
				<?php echo $this->Html->link('<i class="icon-list-alt"></i>', array('action' => 'view', $trabalho['Trabalho']['id']), array('title'=>__('Ver/Definir revisor'), 'escape'=>false, 'class'=>'btn')); ?>
				<?php echo $this->Form->postLink('<i class="icon-trash"></i>', array('action' => 'delete', $trabalho['Trabalho']['id']), array('title'=>__('Delete'), 'class'=>'btn', 'escape'=>false), __('Deseja apagar o trabalho %s?', $trabalho['Trabalho']['titulo'])); ?>
			</div>
		</div>
	</td>
</tr>
<?php endforeach; ?>
<tbody>
</table>
<p class="text-info">
<?php
echo $this->Paginator->counter(array(
'format' => __('Página {:page} de {:pages}, total de {:count} registros')
));
?>	</p>
<div class="pagination pagination-centered">
	<ul>
		<?php echo $this->Paginator->prev(
			'< '.__('Anterior'),
			array('tag' => 'li', 'class' => 'prev'),
			'<a>< '.__('Anterior').'</a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
		<?php echo $this->Paginator->numbers(array('separator' => '', 'tag'=>'li', 'currentTag'=>'a', 'currentClass'=>'active')); ?>
		<?php echo $this->Paginator->next(
			__('Próximo'). ' >',
			array('tag' => 'li', 'class' => 'prev'),
			'<a>'.__('Próximo').' ></a>',
			array('tag' => 'li', 'escape' => false, 'class' => 'prev disabled')
		);?>
	</ul>
</div>